﻿@model EM.OA.Portal.Models.WFApplyModels
@{
    Layout = "~/Views/Shared/_LayoutContent.cshtml";
}
<script type="text/javascript" src="~/Scripts/page/WFApply.js"></script>
<style type="text/css">
    .left {
        text-align: left;
        width: 80%;
    }

    .right {
        text-align: right;
        width: 20%;
    }
</style>

<form id="fm" method="post">
    @Html.HiddenFor(m => m.ApplyID)

    <table width="100%">
        <tr>
            <td class="right">
                @Html.LabelFor(m => m.ApplyUserID)：
            </td>
            <td class="left">
                @ViewBag.UserName
            </td>
        </tr>
        <tr>
            <td class="right">
                @Html.LabelFor(m => m.ApplyDepartmentID)：
            </td>
            <td class="left">
                @ViewBag.OUName
            </td>
        </tr>
        <tr>
            <td class="right">@Html.LabelFor(m => m.ApplyFlowConfigID)：</td>
            <td class="left">
                @Html.HiddenFor(m=>m.ApplyFlowConfigID)
                @Html.Partial("~/Views/Shared/_WFFlowPartial.cshtml")
            </td>
        </tr>
        <tr>
            <td class="right" valign="top">
                @Html.LabelFor(m => m.ApplyContent)：
            </td>
            <td class="left">
                @Html.TextAreaFor(m => m.ApplyContent, new { @style = "width:80%", @rows = "5", @class = "easyui-validatebox" })
            </td>
        </tr>
        <tr>
            <td class="right">@Html.LabelFor(m=>m.ApprovalUserID)：</td>
            <td class="left">
                @Html.HiddenFor(m=>m.ApprovalUserID)
                <input class="easyui-combobox" id="com_ApprovalUserID" name="com_ApprovalUserID" 
                    data-options="valueField:'id',textField:'text'">
            </td>
        </tr>
        <tr>
                <td style="text-align: right;">@Html.Label("附件")：</td>
                <td>
                    <a href="#">附件上传</a>
                    <span style="color: #808080">单次上传文件大小不能超过20M。</span>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">@Html.CheckBoxFor(m => m.IsWebMessage)</td>
                <td>@Html.LabelFor(m => m.IsWebMessage)</td>
            </tr>
            <tr>
                <td style="text-align: right;">@Html.CheckBoxFor(m => m.IsSMS)</td>
                <td>@Html.LabelFor(m => m.IsSMS)</td>
            </tr>
            <tr>
                <td style="text-align: right;">@Html.CheckBoxFor(m => m.IsEmail)</td>
                <td>@Html.LabelFor(m => m.IsEmail)</td>
            </tr>
        <tr>
            <td>&nbsp;</td>
            <td><a href="#" class="easyui-linkbutton" iconcls="icon-ok" onclick="Submit()">提交</a>
                <a href="#" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">取消</a></td>
        </tr>
    </table>
</form>

<script type="text/javascript">
    function Submit() {
        var approvalUserID = $('#com_ApprovalUserID').combobox('getValue');
        $('#ApprovalUserID').val(approvalUserID);
        $('#ApplyFlowConfigID').val($('#hi_FlowConfigID').val());
        $('#fm').form('submit', {
            url: "/WFApply/Create",
            onSubmit: function () {
                return $(this).form('validate');
            },
            success: function (result) {
                if (result == 'OK') {
                    alert("提交成功！");
                    //$('#dlg').dialog('close');      // close the dialog  
                    //$('#list').datagrid('reload');    // reload the user data  
                } else {
                    $.messager.show({
                        title: 'Error',
                        msg: result
                    });
                }
            }
        });
    }
</script>
